import axios from 'axios'
let IP = 'http://114.55.238.138:8088'
    // let IP = 'http://192.168.1.113:8088'
    // let IP = 'http://192.168.1.116:80'

// 基本请求路径
axios.defaults.baseURL = IP
export let imgsrcip = IP


// 图片上传
export const ITEMS_IMG_UPLOAD = IP + '/teacher/uploadHeadImg'
export const ITEMS_IMG_UPLOAD_HOMEIMG = IP + '/HomeImg/addhomeImg'

// echarts
export let echartss=()=>axios.get('apiais/findcount')

//查询首页轮播图
export let findHomeImg=()=>axios.get('/HomeImg/findHomeImg')
//删除轮播图
export let HomeImg=(id)=>axios.post('/HomeImg?id='+id)
//保存轮播图
export let homeurl=(url)=>axios.post('/HomeImg/saveImg?url='+url)
// 日志管理
export let logs=(limit, page, opername)=>axios.get('/logs/findPager',{ params: { limit, page, opername } })
let base=''
export const uploadFileRequest = (url, params) => {
        return axios({
            method: 'post',
            url: `${base}${url}`,
            data: params,
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        });
    }
    // 登录
export let login = (params) => axios.post('/user/login', params)
    //用户注销
export let logout = () => axios.get('/user/logout')
//用户列表
export let userlist = (limit, page, username,roles) => axios.get('/user/findPage', { params: { limit, page, username,roles } })
//删除用户
export let userdel = (uid) => axios.post('/user/deletebyuid?uid=' + uid)
//添加用户
export let adduser=(params)=>axios.post('/user/add',params)
//修改用户
export let edituser=(params)=>axios.post('/user/updatebyuid',params)
//根据id查找用户
export let findbyid=(uid)=>axios.post('/user/findbyuid?uid='+uid)
// -----------------------文章添加---------------------------
export let articaladd = (params) => axios.post('/add/Article', params)
    //文章列表 本科生
export let findPageBen = (limit, page, title) => axios.get('/particle/findPageBen', { params: { limit, page, title } })
    //文章列表 研究生
export let findPageYan = (limit, page, title) => axios.get('/particle/findPageYan', { params: { limit, page, title } })
    //合作交流
export let findPage = (limit, page, title) => axios.get('/Comarticle/findPage', { params: { limit, page, title } })
    //项目成果
export let result1 = (limit, page, title) => axios.get('/result/findPage', { params: { limit, page, title } })
    //中心概括
export let briefinfo = (limit, page, title) => axios.get('/brief/findPage', { params: { limit, page, title } })
    // ------------------------删除文章-----------------------------
    // 交流合作
export let comdel = (id) => axios.post('/Comarticle/deletebyid?id=' + id)
    //项目成果
export let resdel = (id) => axios.post('/result/deletebyid?id=' + id)
    //人才培养-本科生
export let bendel = (id) => axios.post('/particle/deletebyid?id=' + id)
    //研究生
export let yandel = (id) => axios.post('/particle/deletebyid?id=' + id)
    //-------------------------教师列表-------------------------
    //分页查询
export let teacherlist = (limit, page, name) => axios.get('/teacher/findPage', { params: { limit, page, name } })
    //删除教师
export let teadel = (id) => axios.post('/teacher/deletebyid?id=' + id)
    //添加教师
export let addteacher = (params) => axios.post('/teacher/add', params)
    //修改教师
export let updatetea = (params) => axios.post('/teacher/updatebyid', params)
    //通过id查找教师
export let teaid = (id) => axios.get('/teacher/findbyid?id=' + id)
    //-------------------------编辑文章-----------------------------
    // 通过查询文章  交流合作
export let comid = (id) => axios.get('/Comarticle/findbyid?id=' + id)
export let updatecom = (params) => axios.post('/Comarticle/updatebyid', params)

//编辑本科生 研究生
export let updatepeo = (params) => axios.post('/particle/updatebyid', params)
export let parpeo = (id) => axios.get('/particle/findbyid?id=' + id)

// 编辑研究成果
export let updateres = (params) => axios.post('/result/updatebyid', params)
export let resu = (id) => axios.get('/result/findbyid?id=' + id)
    // 编辑中心概括
export let updatebri = (params) => axios.post('/brief/updatebyid', params)

//查询简介
export let brief = () => axios.get('/brief/info')
    //查询所有教师
export let teacher = () => axios.get('/teacher/findAll')
    //id查询教师
export let teacher_detail = (params) => axios.get('/teacher/findbyid', { params })
    //分页查询本科生
export let undergraduate = (params) => axios.get('/particle/findPageBen', { params })
    //id查询本科生
export let undergraduate_detail = (params) => axios.get('/particle/findbyid', { params })
    //分页查询研究生
export let yan = (params) => axios.get('/particle/findPageYan', { params })
    //分页查询合作交流
export let com = (params) => axios.get('/Comarticle/findPage', { params })
    //id查询合作交流
export let comart = (params) => axios.get('/Comarticle/findbyid', { params })
    //分页查询项目成果
export let result = (params) => axios.get('/result/findPage', { params })
    //id查询项目成果
export let result_de = (params) => axios.get('/result/findbyid', { params })
    //查询人才培养后n条
export let particle = (params) => axios.get('/particle/findcount', { params })
    //查询轮播
export let lunbo = (params) => axios.get('/HomeImg/findHomeImg', { params })